<%
  system.SetSessionVar("sessionTAB", "startpageguest");
%>

<table class="CLASS05900">
<tr>
<%
  object oFavorites = dom.GetObject( ID_FAVORITES );
  if( oFavorites )
  {
    object oFavoriteList = oFavorites.Get( "_USER"#system.GetSessionVar("sessionUserID") );
    if( oFavoriteList )
    {
      if( oFavoriteList.Count() == 0 )
      {
        Write('<table id="guestPage" cellpadding="0" cellspacing="0" class="CLASS05907" style="display:none">');
        Write('<tr>');
        Write('<td class="CLASS05908"></td>');
        Write('<td class="CLASS05909"></td>');
        Write('</tr>');
        Write('<tr>');
        Write('<td colspan="2" class="CLASS05910">${noFavoritesAvailableGuest}');
        Write('</tr>');
        Write('<tr>');
        Write('<td class="CLASS05908"></td>');
        Write('<td class="CLASS05909"></td>');
        Write('</tr>');
        Write('</table>');
      }
      string s;
      Write('<table id="tblFavs" cellpadding="0" cellspacing="0" class="CLASS05900">');
      Write('<tr>');
      integer i = 0;
      foreach(s,oFavoriteList.EnumIDs())
      {
        object oFav = dom.GetObject(s);
        if( oFav )
        {
          i = i + 1;
           string sInfo = oFav.EnumInfo();
            if( !sInfo.Length() ) { sInfo = "${lblWithoutDescription}"; }
              string sName = oFav.Name();
              Write('<td>');
                Write('<table cellpadding="0" cellspacing="0" class="CLASS05901">');
                Write('<tr>');
                  Write('<td class="CLASS05902"></td>');
                  Write('<td class="CLASS05903"></td>');
                Write('</tr>');
                Write('<tr>');
                  string lineHeight= "74px";
                  if (sName.Length() > 14) {
                    lineHeight = "37px";
                  }
                  if (sName.Length() > 28) {
                    lineHeight = "26px";
                  }
                  integer iLength = 14;
                  Call("/esp/datapointconfigurator.fn::StringCut()");
                  Write('<td class="CLASS05904"><div style="line-height:' # lineHeight # ';" class="CLASS05905" onclick="WebUI.enter(ControlFavoritePage, '#oFav.ID()#');">'#sName#'</div></td>');
                  Write('<td class="CLASS05906">'#sInfo#'</td>');
                Write('</tr>');
                Write('<tr>');
                  Write('<td class="CLASS05902"></td>');
                  Write('<td class="CLASS05903"></td>');
                Write('</tr>');
                Write('</table>');
              Write('</td>');
          if( !(i%2) )
          {
            Write( "</tr><tr>" );
          }
        }
      }
      Write('</tr></table>');
    }
    else
    {
      Write( '<option>${noFavoritesAvailableGuest}</option>' );
    }
  }
  %>
</tr>
</table>

<script type="text/javascript">
  setPath("");
  hide("AlarmMsg");
  hide("ServiceMsg");
  hide("AlarmServiceMsg");


    if (screen.width < 1200) {
      var headerPercentage  = 12;
      var contentPercentage = 83;
      var footerPercentage  = 5;
    }
    else{
      var headerPercentage  = 8;
      var contentPercentage = 86;
      var footerPercentage  = 6;
    }
      
      var wHeight = 0;
      if (window.innerHeight) {
        wHeight = window.innerHeight;
      } 
      else if (document.documentElement.offsetHeight) {
        wHeight = document.documentElement.offsetHeight;
      }

      $("header").setStyle({height: ((wHeight / 100) * headerPercentage - 8) + "px"});
      $("content").setStyle({height: ((wHeight / 100) * contentPercentage - 9) + "px"});
      $("footer").setStyle({height: ((wHeight / 100) * footerPercentage - 9) + "px"});

      translatePage("#header, #guestPage");
      translatePage("#tblFavs, #tblNoFavs");
      jQuery("#guestPage").css("display","table");

      setFooter("");
</script>
